home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Views / Standard Views / Progress.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  845 b   |  47 lines  |  [TEXT/CWIE]

  1. // Progress.h
  2.  
  3. #ifndef Progress_h
  4. #define Progress_h
  5.  
  6. #ifndef Announcer_h
  7. #include "Announcer.h"
  8. #endif
  9. #ifndef Integers_h
  10. #include "Integers.h"
  11. #endif
  12.  
  13. class Progress: public Announcer
  14.   {
  15.     private:
  16.         uint32 portion;
  17.         uint32 total;
  18.         bool totalKnown;
  19.         
  20.     public:
  21.         Progress();
  22.         Progress( uint32 total );
  23.         
  24.         bool TotalKnown() const        { return totalKnown; }
  25.         uint32 Portion() const        { return portion; }
  26.         uint32 Total() const            { Assert( totalKnown ); return total; }
  27.         
  28.         double Fraction() const;
  29.         
  30.         bool Finished() const        { return portion >= total; }
  31.         bool Unfinished() const        { return portion < total; }
  32.         
  33.         void Clear();
  34.         void Clear( uint32 );
  35.         
  36.         void SetTotal( uint32 );
  37.         
  38.         void SetPortion( uint32 );
  39.         
  40.         void Set( uint32 portion, uint32 total );
  41.         
  42.         void operator++();
  43.         void operator++(int)            { operator++(); }
  44.   };
  45.  
  46. #endif
  47.